﻿using System;
using System.Windows;
using System.Windows.Controls;
using Microsoft.Practices.Unity;
using XamlaApp.ViewModels;
using XamlaApp.Views.ElementMenuButtonViews;
using XamlaApp.Views.ElementPropertyViews;
using XamlaApp.Interfaces;

namespace XamlaApp.Views.ElementViews
{
    public partial class BorderView : UserControl, IXamlaElement
    {
        [Dependency]
        public BorderViewModel VM { get; set; }
        [Dependency]
        public BorderProperties PropView { get; set; }

        public BorderView()
        {
            InitializeComponent();
            Loaded += BorderView_Loaded;
        }

        void BorderView_Loaded(object sender, RoutedEventArgs e)
        {
            VM.RegisterPositionBoundElement(this);
            VM.RegisterProjectionBoundElement(this);
            PropView.VM = VM;
            DataContext = VM;

        }

        #region IXamlaElement Members

        public UserControl Propertyview
        {
            get { return PropView; }
        }

        public string ControlName
        {
            get;
            set;
        }

        public FrameworkElementViewModel ViewModel
        {
            get { return VM; }
        }

        public UserControl MenuButton
        {
            get
            {
                return Container.AppContainer.Resolve<BorderMenuButtonContent>();
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        public System.Windows.Media.PlaneProjection ElementProjection
        {
            get { return projBorder;}
        }

        #endregion
    }
}
